﻿using Abp.Dependency;

using Abp.Events.Bus.Entities;
using Abp.Events.Bus.Handlers;
using Abp.RemoteEventBus;
using Abp.Runtime.Caching;
using FwProject.AppHome.Dto;
using FwProject.Shop.Dto;
using FwProject.ShoppingMall.Shop;
using System;
using System.Collections.Generic;
using System.Text;

namespace FwProject.EventHandle
{
    public class ShopAdHandle : IEventHandler<EntityChangedEventData<ShopProduct>>,
        ITransientDependency
    {
        public readonly ICacheManager _catchmanager;
        public IRemoteEventBus remoteEventBus { get; set; }
      
        public ShopAdHandle(ICacheManager catchmanager)
        {
            remoteEventBus = NullRemoteEventBus.Instance;
            _catchmanager = catchmanager;
        }
        /// <summary>
        /// 广告发生变化
        /// </summary>
        /// <param name="eventData"></param>
        public void HandleEvent(EntityChangedEventData<ShopProduct> eventData)
        {
            _catchmanager.GetCache(nameof(HomeDto)).Remove("index");
        }

    }
}
